import request from '@/utils/request'
import { GEN_SERVER } from '@/config/baseUrl'

//查询工单列表
export function orderList(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/list',
    method: 'post',
    data: data
  })
}

//查询处方列表
export function erpPrescList(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpPresc/list',
    method: 'post',
    data: data
  })
}

//查询处方详情
export function erpPrescDetail(id) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpPresc/detail',
    method: 'get',
    params: {
      id: id
    }
  })
}

// 删除生产工单
export function deleteOrderByIds(ids) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/deleteByIds',
    method: 'post',
    params: {
      ids: ids
    }
  })
}

// 确认生产工单
export function confirmOrder(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/confirmOrder',
    method: 'post',
    params: data
  })
}

// 取消确认生产工单
export function cancelOrder(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/undoConfirmOrder',
    method: 'post',
    params: data
  })
}

//关闭生产工单
export function closeOrder(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/closeOrder',
    method: 'post',
    data: data
  })
}

//更新生产工单
export function updateOrder(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/updateOrder',
    method: 'post',
    data: data
  })
}

//提交工单创建
export function submitOrder(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/submitOrder',
    method: 'post',
    data: data
  })
}

//新增或保存生产工单
export function addOrUpdate(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/addOrUpdate',
    method: 'post',
    data: data
  })
}

//查询工单详情(确认及取消确认场景使用)
export function getOrderDetail(id) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/detail',
    method: 'get',
    params: {
      id
    }
  })
}

//查询生产工单详情--工单关闭场景
export function getOrderCloseDetail(id) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/detailToClose',
    method: 'get',
    params: {
      id
    }
  })
}

//刷新工单相关数量数据
export function refershOrderQtys(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/refershOrderQtys',
    method: 'post',
     data: data
  })
}

